package com.stylefeng.guns.modular.customer.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.datascope.DataScope;
import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.modular.system.model.CustomerCompany;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface CustomerCompanyDao {

    CustomerCompany selectByUnifiedSocialCreditCode(@Param("unifiedSocialCreditCode") String unifiedSocialCreditCode);

    List<Map<String,Object>> list(@Param("dataScope") DataScope dataScope,
                                  @Param("page") Page<CustomerCompany> page,
                                  @Param("name") String name,
                                  @Param("customerTypeCode") String customerTypeCode,
                                  @Param("salesmanId") Integer salesmanId);

    List<ZTreeNode> tree(@Param("dataScope") DataScope dataScope);

    List<CustomerCompany> selectByDeptId(@Param("deptId") Integer deptId);

    List<CustomerCompany> selectBySalesmanId(@Param("salesmanId") Integer salesmanId);

    List<CustomerCompany> getCustomerCompanies(@Param("set") Set<Long> relationCustomerIds);

    /**
     * 判断用户是否存在 1：存在 null:不存在
     * @param id
     * @param unifiedSocialCreditCode 统一社会信用代码
     * @param militaryCode  军工代码
     * @return
     */
    Integer customerCompanyExisted(@Param("id") Integer id ,
                                   @Param("unifiedSocialCreditCode") String unifiedSocialCreditCode,
                                   @Param("militaryCode") String militaryCode);
}

